/*package com.suning.sawp.web.controller;

import java.io.IOException;
import java.security.Principal;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.suning.sawp.service.util.HttpClientUtil;
import com.suning.vgs.follow.remote.intf.RmsRemoteService;
import com.suning.vgs.follow.remote.intf.StoreManRemoteService;
import com.suning.vgs.follow.remote.store.StoreWorkerInfo;
import com.suning.vgs.im.aas.service.dto.VerifyTokenResultBean;
import com.suning.vgs.im.aas.service.intf.AuthService;

@Controller
@RequestMapping("storeplus/ptt")
public class PrototypeManageController {

    *//**
     * 日志
     *//*
    private static final Logger LOGGER = LoggerFactory.getLogger(PrototypeManageController.class);

    @Value("#{ipsConfig[url_storeplus_prototype_querybrand]}")
    String queryBrandUrl;

    @Value("#{ipsConfig[url_storeplus_prototype_querypttlist]}")
    String queryPttListUrl;
    
    @Value("#{ipsConfig[url_storeplus_prototype_queryPrototypeInfo]}")
    String queryPrototypeInfoUrl;
    
    @Value("#{ipsConfig[url_storeplus_prototype_saverelation]}")
    String saverelationUrl;
    
    *//**
     * 校验店员登录状态
     *//*
    @Autowired
    AuthService authService;

    @Resource
    RmsRemoteService rmsRemoteService;

    @Resource
    StoreManRemoteService storeManRemoteService;

    *//**
     * 获得所有的品类信息
     * @return
     *//*
    @RequestMapping(value="getAllClass")
    @ResponseBody
    public String getAllClass() {
        StringBuilder sb = new StringBuilder();
        sb.append("[ {code: \"3\", label: \"黑电\"}, {code: \"13\", label: \"厨卫\"}, {code: \"2\", label: \"冰洗\"}, ")
                .append("{code: \"6\", label: \"通讯\"}, {code: \"5\", label: \"电脑\"}, {code: \"1\", label: \"空调\"}, ")
                .append("{code: \"4\", label: \"数码\"}, {code: \"7\", label: \"小家电\"}, {code: \"11\", label: \"OA办公\"}]");
        return sb.toString();
    }

    *//**
     * 根据商品所属品类
     * @param categoryCode
     * @return
     *//*
    @RequestMapping(value = "getCategoryBrand.do", produces = "text/html;charset=utf-8")
    public void findBrandOfClass(String categoryCode, HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        LOGGER.debug("查询品类的品牌信息categoryCode=", categoryCode);

        StringBuilder url = new StringBuilder();

        url.append(queryBrandUrl).append(categoryCode);
        // 获取cookie
        String cookie = request.getHeader("Cookie");
        // 发送请求
        String str = HttpClientUtil.getData(url.toString(), cookie, null);
        // 打印
        write(str, response);
    }

    @RequestMapping(value = "queryPrototypeList.do", produces = "text/html;charset=utf-8")
    public void queryPrototypeList(String categoryCode, String brand, String queryStr, String pageIndex,
            String pageSize, HttpServletRequest request, HttpServletResponse response) throws Exception {

        String staffCode = this.getStaffCode(request);

        // 通过当前用户获得用户是否登录
        String storeCode = getStoreCode(request);

        String queryString = request.getQueryString();
        String url = queryPttListUrl + queryString + "&staffCode="
                + staffCode + "&storeCode=" + storeCode;
        // 发送请求
        String str = HttpClientUtil.getData(url.toString(), request.getHeader("Cookie"), null);
        // 打印
        write(str, response);
    }

    @RequestMapping(value = "queryPrototypeInfo.do", produces = "text/html;charset=utf-8")
    public void queryPrototypeInfo(String pttId, HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        String queryString = request.getQueryString();
        String storeCode = this.getStoreCode(request);
        String url = queryPrototypeInfoUrl + queryString
                + "&storeCode=" + storeCode;
        // 发送请求
        String str = HttpClientUtil.getData(url.toString(), request.getHeader("Cookie"), null);
        // 打印
        write(str, response);
    }

    @RequestMapping(value = "saveGoodsRelation.do", produces = "text/html;charset=utf-8")
    public void saveRelation(String goodsCode, String[] eBuyGoods, String[] storeCoods, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        String staffCode = this.getStaffCode(request);
        String storeCode = this.getStoreCode(request);
        String queryString = request.getQueryString();
        String url = saverelationUrl + queryString + "&staffCode="
                + staffCode + "&storeCode=" + storeCode;
        // 发送请求
        String str = HttpClientUtil.getData(url.toString(), request.getHeader("Cookie"), null);
        // 打印
        write(str, response);
    }

    private String getStaffCode(HttpServletRequest request) {
        String token = request.getParameter("token");
        String staffCode = "";
        if (StringUtils.isNotEmpty(token)) {
            final VerifyTokenResultBean resultBean = authService.verifyToken(token);
            if (null != resultBean && resultBean.getAccount() != null) {
                staffCode = resultBean.getAccount().getUserid();
            }
        }
        return staffCode;
    }

    private String getStoreCode(HttpServletRequest request) {
        Principal userPrincipal = request.getUserPrincipal();
        if (null != userPrincipal && StringUtils.isNotEmpty(userPrincipal.getName())) {
            StoreWorkerInfo workInfo = storeManRemoteService.getWorkInfo(userPrincipal.getName());
            return workInfo.getStoreCode();
        }

        return "7058";
    }
    
    *//**
     * 
     * 功能描述: <br>
     * 〈功能详细描述〉
     * 
     * @param html html文本
     * @param response
     * @throws IOException
     *//*
    private void write(String html, HttpServletResponse response) throws IOException {
        response.setCharacterEncoding("utf-8");
        response.setHeader("Content-Language", "zh-CN");
      //强制不缓存
        response.setHeader("Cache-Control", "no-cache");
        response.setContentType("text/html; charset=UTF-8");
        response.getOutputStream().print(html);
        response.getOutputStream().flush();
    }
}
*/